<%@page import="java.util.ArrayList"%>
<%@page import="java.util.LinkedHashMap"%>
<%@page import="java.util.Map"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>bootstrap的form表单布局</title>
<!---引入jquery资源--->
<script type="text/javascript"
	src="../js/bootstrap-3.3.7-dist/js/jquery.min.js"></script>
<!--引入bootstrap的核心js资源文件--->
<script type="text/javascript"
	src="../js/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<!--引入bootstrap的核心css资源文件--->
<link rel="stylesheet" type="text/css"
	href="../js/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
</head>

<body>
	<%
		// 缓存一个list
		List lst2 = new ArrayList();
		Map map0 = new LinkedHashMap();
		map0.put("stuName", "小明");
		map0.put("stuAge", 21);
		map0.put("stuSex", "男");
		lst2.add(map0);
		Map map1 = new LinkedHashMap();
		map1.put("stuName", "小赵");
		map1.put("stuAge", 22);
		map1.put("stuSex", "男");
		lst2.add(map1);
		// 将其缓存到session中
		request.setAttribute("lst2", lst2);
	%>
	<br>使用嵌套foreach标签遍历具有层次结构的list结果集的内容（等价于java的双层循环）
	<br>

	<div class="bs-example" data-example-id="hoverable-table">
		<table class="table table-hover">
			<thead>
				<tr>
					<th>序号</th>
					<th>姓名</th>
					<th>年龄</th>
					<th>性别</th>
				</tr>
			</thead>
			<tbody>
				<!-- 外层循环，控制行数 -->
				<c:forEach items="${requestScope.lst2 }" var="ev" varStatus="st">
					<!-- 一个tr就是一行数据 -->
					<tr>
						<th>${st.index+1 }</th>
						<!-- 循环map每个键值对的值 -->
						<c:forEach items="${ev }" var="subv">
							<td>${subv.value }</td>
						</c:forEach>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</div>	
</body>
</html>